import React, { Component } from 'react'
import "./App.css";
import axios from 'axios';
export default class App extends Component {
    render() {
        return (
            <div className="container">
                <button className="btn btn-primary" onClick={this.getNews}>获取新闻</button>
                &nbsp;<button className="btn btn-info" onClick={this.getRecommend}>获取推荐</button>
                &nbsp;<button className="btn btn-info" onClick={this.getMovie}>获取电影信息</button>
                &nbsp;<button className="btn btn-info" onClick={this.getCity}>获取城市</button>
            </div>
            
        )
    }

    getNews = async () => {
        let url = '/zh/api/v3/feed/topstory/hot-lists/total?limit=50&desktop=true';
        //发送 AJAX 请求
        let result = await axios(url);
        console.log(result);
    }

    getRecommend = async () => {
        //设置 url
        let url = '/zh/api/v4/zvideo-tabs/tabs/choice/feeds/recommend?limit=12&trans=%08%00%01%00%00%00%04%0B%00%02%00%00%00+1d4a13061a42f6b77ad392cbedd7718d%00'
        //发送
        let result = await axios.get(url);

        console.log(result);
    }

    getMovie = async () => {
        //设置 url
        let url = '/mt/ptapi/getHotFilms?ci=1&limit=10'
        //发送
        let result = await axios.get(url);

        console.log(result);
    }

    getCity = async () => {
        //设置 url
        let url = '/mt/ptapi/minsuCitys?fetchSize=10'
        //发送
        let result = await axios.get(url);

        console.log(result);
    }
}
